﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommentHistory.aspx.cs"
    Inherits="ZLCMS.Web.Wap.Shop.CommentHistory" MasterPageFile="~/Wap/Shop/ShopSite.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%@ register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
    <title>已评价</title>
    <style type="text/css">
        #nav li
        {
            border-left: 1px solid #ddd;
            box-sizing: border-box;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            border-bottom: 1px solid #ddd;
        }
        #nav li:nth-child(1)
        {
            border-left: none;
        }
        #navFixed .ui-navbar ul li a.ui-btn-active
        {
            color: #f9384d;
            border-bottom-color: #f9384d;
        }
        .all_comment .top .left
        {
            float: left;
            width: 30%;
        }
        .all_comment .top .right
        {
            float: right;
            width: 70%;
        }
        .all_comment .manager div
        {
            overflow: hidden;
            color: #999;
            position: relative;
            word-break: break-all;
            margin-top: 2px;
            word-wrap: break-word;
            line-height: 16px;
        }
        .all_comment .manager
        {
            padding-top: 10px;
            margin-top: 15px;
            overflow: inherit;
            border-top: 1px solid #e0e0e0;
            position: relative;
        }
        .all_comment .manager::before, .all_comment .manager::after
        {
            content: "";
            height: 0;
            width: 0;
            display: block;
            border-width: 10px;
            border-style: dashed dashed solid dashed;
            border-color: transparent transparent #e0e0e0 transparent;
            position: absolute;
            left: 12px;
            top: -20px;
            font-size: 0px;
            line-height: 0px;
            overflow: hidden;
        }
        .all_comment .manager::after
        {
            border-bottom-color: #fff;
            margin-top: 1px;
        }
        .all_comment .manager span
        {
            float: left;
            color: #f39800;
            font-size: 12px;
        }
        .all_comment .manager p
        {
            float: right;
        }
        .all_comment .optbtn
        {
            text-align: right;
        }
        
        #mypage .all_comment .right .btn
        {
            background: #f9384d none repeat scroll 0 0;
            color: #fff;
            font-size: 12px;
            font-weight: normal;
            margin: 0 5px 0 0;
            padding: 3px 10px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
    <div data-role="page" id="mypage">
        <!--s nav-->
        <div id="navFixed">
            <div id="nav">
                <div data-role="navbar" nav="navFixed">
                    <ul>
                        <li><a href="/Wap/Shop/CommentList.aspx?cs=0" data-theme="f" data-ajax="false">待评价</a></li>
                        <li><a href="#" data-theme="f" class='ui-btn-active'>已评价</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!--e nav-->
        <!--S header -->
        <div data-role="header">
        </div>
        <!-- /navbar -->
        <div role="main" class="ui-content">
            <div class="prolist_nav">
                <input type="hidden" id="MemberAccount" value='<%=CurrentMemberAccount %>' />
            </div>
            <div class='commentProductList'>
            </div>
            <div style="display: none">
                <button id="btnMore" data-icon="refresh" style="width: 95%; margin-left: auto; margin-right: auto;">
                    显示更多</button>
            </div>
        </div>
        <!--S footer -->
        <div data-role="footer" data-position="fixed" data-tap-toggle="false">
            <uc1:Footer ID="Footer1" runat="server" MenuId="M" />
        </div>
        <!--E footer -->
    </div>
    <script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
    <script type="text/javascript">

        function LoadCommentList() {
            var handler = $('.commentProductList').listviewHandler();
            handler.initialize({
                loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
                emptyHtml: '<div style="text-align: center; font-size: 12px; color:#666; margin-top:2em">-- 暂无评价记录 --</div>', //无记录时显示此html
                itemTemplate2: ' <div class="all_order">'
                + '    <a href="/Wap/Shop/ProductDetail.aspx?no={TargetCode}" data-ajax="false">'
                + '        <div class="bottom">'
                + '            <div class="right commentHistory" style="width:100%">'
                + '            <h2><span>{ProductName}</span> '
                + '                    <font color="red">我的评分 ：{Score}</font></h2>'
                + '                <h2>{RecordDate}</h2>'
                + '                <p>'
                + '                    {Content}</p>{ImgUrl}'
                + '            </div>'
                + '            <div class="clear">'
                + '            </div>'
                + '        </div>'
                + '    </a>'
                + '</div>', //项模板
                itemTemplate: ' <div class="all_comment">'
                              + '<div class="top">'
                              + '<div class="left">'
                              + '<p>{RecordDate}</p>'
                              + ' </div>'
                              + ' {DefaultHtml}'
                              + '<div class="clear"></div>'
                              + ' </div>'
                              + '<a href="/Wap/Shop/ProductDetail.aspx?no={TargetCode}" data-ajax="false">'
                              + ' <div class="bottom">'
                              + '<div class="left"><img src="{ProductImg}"></div>'
                              + '  <div class="right">'
                              + ' 	<h2>{ProductName}</h2>'
                //                              + ' <p>我的评分：<span>{Score}</span></p>'
                              + '<div id="star">'
                                + '<span>我的评分：</span>'
                                + '<ul>'
                                    + '<li class="on-{Score}"></li>'
                                + '</ul>'
                              + ' </div>'
                              + ' </div>'
                              + ' <div class="clear"></div>'
                              + ' </div></a>'
        	                  + '<div class="history">'
                              + '<p>{Content}</p>{ImgUrl}'
                              + ' <div class="clear"></div>'
                              + '{AppendHtml}'
                              + '{ReplayHtml}'
                              + ' </div>'
                              + ' <div class="optbtn"><div class="right">{OptionHtml}</div></div>'
                              + ' </div>', //项模板
                pageIndex: 1, //页码（从1起算）
                pageSize: 20, //页大小
                totalCount: 999, //总记录数
                itemHandler: function (data, itemTemplate, container) {//数据各项处理
                    if (data.ImgUrl) {
                        var imgArr = $.parseJSON(data.ImgUrl);
                        var imgHtml = '';
                        $(imgArr).each(function () {
                            imgHtml += '<li><img src="' + ($.cookie('imagesvr') ? $.cookie('imagesvr') : '') + this.FilePath + '"></li>';
                        });
                        data.ImgUrl = '<ul>' + imgHtml + '</ul>'
                    } else { data.ImgUrl = ''; }
                    data.RecordDate = data.RecordDate.substr(0, 10);
                    data.OptionHtml = '';
                    data.AppendHtml = '';
                    data.ReplayHtml = '';
                    data.DefaultHtml = '';
                    if (data.AppendStatus == 1) {//已追评
                        var appendImageHtml = '';
                        if (data.AppendImage) {
                            var imgArr = $.parseJSON(data.AppendImage);
                            var imgHtml = '';
                            $(imgArr).each(function () {
                                imgHtml += '<li><img src="' + ($.cookie('imagesvr') ? $.cookie('imagesvr') : '') + this.FilePath + '"></li>';
                            });
                            appendImageHtml = '<ul>' + imgHtml + '</ul>'
                        }
                        data.AppendHtml = (' <div class="manager">' +
                             '<div>' +
                                ' <span>[追加评论]</span><p>{AppendTime}</p>' +
                             '</div>' +
                             '<div>' +
                                 '{AppendContent}{AppendImage}' +
                             '</div>' +
                         '</div>').format({ AppendTime: data.AppendTime, AppendContent: data.AppendContent, AppendImage: appendImageHtml });
                    } else {
                        if (data.TargetType == 0) {
                            data.DefaultHtml = '<div class="right" style="text-align: right; font-size: 12px; color:#999;"><p>[默认]</p></div>';
                            data.OptionHtml += '<a class="btn" data-ajax="false" href="CommentAppend.aspx?comment={Id}&type=changeAll&ono={TargetSubCode}">修改默认评论</a>'.format({ Id: data.Id, TargetSubCode: data.TargetSubCode });
                        }
                        else {
                            data.OptionHtml += '<a class="btn" data-ajax="false" href="CommentAppend.aspx?comment={Id}&type=append&ono={TargetSubCode}">追加评论</a>'.format({ Id: data.Id, TargetSubCode: data.TargetSubCode });
                        }
                    }
                    if (data.Score < 5) {
                          if (data.DateOut) {
                              data.OptionHtml += '<a class="btn" data-ajax="false" href="CommentAppend.aspx?comment={Id}&type=changeSC&ono={TargetSubCode}">修改评论</a>'.format({ Id: data.Id, TargetSubCode: data.TargetSubCode });
                          }else{
                            data.OptionHtml += '<a class="btn" data-ajax="false" href="CommentAppend.aspx?comment={Id}&type=change&ono={TargetSubCode}">修改评分</a>'.format({ Id: data.Id, TargetSubCode: data.TargetSubCode });
                          }
                    }
                    if (data.Score == 5) {
                        if (data.DateOut) {
                            data.OptionHtml += '<a class="btn" data-ajax="false" href="CommentAppend.aspx?comment={Id}&type=changecontent&ono={TargetSubCode}">修改评论</a>'.format({ Id: data.Id, TargetSubCode: data.TargetSubCode });
                        }
                    }
                    data.ProductImg = firstFilePath(data.ProductImg);

                    $(data.Replies).each(function () {
                        data.ReplayHtml += '<div class="manager">' +
                             '<div>' +
                                ' <span>[V·商城客服]</span><p>' + this.ReplyTime + '</p>' +
                             '</div>' +
                             '<div>' + this.ReplyContent + '</div></div>';
                    });

                    return itemTemplate.format(data);
                },
                command: 'Member.LoadProductCommentHistory',
                parameter: { MemberAccount: $("#MemberAccount").val(), TargetCode: '<%= Request["no"] %>', TargetSubCode: '<%= Request["ono"] %>' }
            });
            handler.nextPage();
        }
        $(function () {
            LoadCommentList();
        })
    </script>
</asp:Content>
